package class_OuterInner;

/**
 * @author Ajie
 * @date 2022/11/16
 * @function
 *  innerClass 可以访问外部的 private 成员变量
 *  OuterPrivate:food:abc
 */
public class OuterPrivate {
    private String priStr = "abc";

    public static void main(String[] args) {
        OuterPrivate outerPrivate = new OuterPrivate();
        outerPrivate.testPri();
    }

    public void testPri(){
        Inner inner = new Inner() {
            @Override
            void food() {
                System.out.println("OuterPrivate:food:"+priStr);//abc
            }
        };
        inner.food();
    }

    abstract class Inner{
        abstract void food();
    }
}
